From: Mathieu Bridon Date: Sat, 15 Dec 2012 10:30:03 +0000 (+0100) Subject: dateMenu: Add "Open Clocks" entry X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5073 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5e5798bee91c38e2f619dafffa4d8ace9a732c6e;p=gnome-shell.git dateMenu: Add "Open Clocks" entry This is similar to how the dateMenu already allows opening the calendar application. However, the new entry only appears if GNOME Clocks is installed, as it is not a core GNOME application. https://bugzilla.gnome.org/show_bug.cgi?id=644390 --- diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 7d027da2c..430ebfbc8 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -93,6 +93,15 @@ const DateMenuButton = new Lang.Class({ this._openCalendarItem.actor.can_focus = false; vbox.add(this._openCalendarItem.actor, {y_align: St.Align.END, expand: true, y_fill: false}); + this._openClocksItem = new PopupMenu.PopupMenuItem(_("Open Clocks")); + this._openClocksItem.connect('activate', Lang.bind(this, this._onOpenClocksActivate)); + this._openClocksItem.actor.can_focus = false; + vbox.add(this._openClocksItem.actor, {y_align: St.Align.END, expand: true, y_fill: false}); + + Shell.AppSystem.get_default().connect('installed-changed', + Lang.bind(this, this._appInstalledChanged)); + this._appInstalledChanged(); + item = this.menu.addSettingsAction(_("Date and Time Settings"), 'gnome-datetime-panel.desktop'); if (item) { item.actor.show_on_set_parent = false; @@ -147,6 +156,11 @@ const DateMenuButton = new Lang.Class({ this._sessionUpdated(); }, + _appInstalledChanged: function() { + let app = Shell.AppSystem.get_default().lookup_app('gnome-clocks.desktop'); + this._openClocksItem.actor.visible = app !== null; + }, + _setEventsVisibility: function(visible) { this._openCalendarItem.actor.visible = visible; this._separator.visible = visible; @@ -198,5 +212,11 @@ const DateMenuButton = new Lang.Class({ let app = Gio.AppInfo.get_default_for_type('text/calendar', false); app.launch([], global.create_app_launch_context()); + }, + + _onOpenClocksActivate: function() { + this.menu.close(); + let app = Shell.AppSystem.get_default().lookup_app('gnome-clocks.desktop'); + app.activate(); } });